import re, os
from website.website_base import WebSiteBase, FetchQueueItem, WebSiteDb
from bs4 import BeautifulSoup
from lib.log import DBG, INFO, ERROR, EXCEPTION
from lib.sqlite_ext import DBApiExt
from website.homeweb.homeweb import Homeweb


class Xxy(Homeweb):
    """
    """
    INDEX_URL = "https://www.xxy4.pics"
    cmdpath = os.path.abspath(os.getcwd())
    DB = os.path.join(cmdpath, "website", "xxy", "xxy.db")
    SAVE_DIR = os.path.join(cmdpath, "website", "xxy", "page")

    def __init__(self):
        super().__init__()

    @classmethod
    def _class_config(cls):
        class_list = [
            {"name": "乱伦", "id": "1"},
            {"name": "出轨", "id": "2"},
            {"name": "制服", "id": "3"},
            {"name": "自慰", "id": "4"},
            {"name": "偷拍", "id": "5"},
            {"name": "自拍", "id": "20"},
            {"name": "国产", "id": "21"},
            {"name": "同性", "id": "22"},
            {"name": "日韩", "id": "23"},
            {"name": "欧美", "id": "24"},
            {"name": "三级", "id": "25"},
            {"name": "动漫", "id": "26"}
        ]

        return class_list

    def _parse_class_page_a_list_content(self, soup):
        li_div = soup.select_one(".img-list")
        lis = li_div.find_all("li")
        return lis


